import {
  ActionValue,
  createAction,
  createActions,
  NoArgAction,
} from 'redux-type-actions';
import {Location, Auth, LanSetting, Channel, EventType, TimeMeta} from 'types';

const actions = createActions({
  // UI
  setActiveTab: createAction<string>(),
  // Data
  setUser: createAction<Auth>(),
  setLocation: createAction<Location>(),
  logout: NoArgAction,
  setDetail: createAction<EventType>(),
  // Settings
  setLocale: createAction<LanSetting>(),
  // query
  getQuery: createAction<Channel[]>(),
  setChannels: createAction<Channel[]>(),
  setSelectedChannel: createAction<Channel>(),
  setSelectedDate: createAction<TimeMeta | undefined>(),
});

export type Action = ActionValue<typeof actions>;

export default actions;
